{include file="public/header"}

<body style="background-color: #f1f1f1;">
<div class="index_html  add_jilu set">
    {include file="public/nav"}


    <div class="list_box set_box">
        <div class="title">
            <p>个人资料</p>
        </div>
        <form action="" class="horizontal" method="post" role="form">

            <div class="content">
                <div class="center">
                    <div class="left" id="avatar">

                        <div id="avatar-container">

                            <div class="img_box">
                                {if condition="$doctor['avatar']"}
                                <img src="{$doctor['avatar']}" alt="">
                                {else/}
                                <img src="__STATIC__/index/imgs/doctor.jpg" alt="">

                                {/if}

                            </div>
                            <strong></strong>
                        </div>
                        <div class="up_box">
                            <a>
                                <span>修改头像</span>
                            </a>
                        </div>

                    </div>
                    <div class="right">
                        <ul>
                            <li>
                                <span>用户名：</span>
                                <em>{$doctor['username']}</em>
                            </li>
                            <li>
                                <span>姓名：</span>
                                <em>{$doctor['name']}</em>
                            </li>
                            <li>
                                <span>所属部门：</span>
                                <em>{$doctor['department']}</em>
                            </li>
                            <li>
                                <span>旧密码：</span>
                                <div class="input_box">
                                    <input type="text" name="oldpassword">
                                </div>
                            </li>
                            <li>
                                <span>新密码：</span>
                                <div class="input_box">
                                    <input type="text" name="password">
                                </div>
                            </li>
                            <li>
                                <span style="font-size: 13px;">确认新密码：</span>
                                <div class="input_box">
                                    <input type="text" name="newpassword">
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="save_or_no">
                    <a class="cirtain">
                        <input type="button" value="确定" class="ajax-post">
                    </a>
                </div>
            </div>
        </form>
    </div>

    <div class="list_box set_box liebiao">
        <div class="title">
            <p>检查项设置</p>
        </div>
        <div class="list_cont">
            <div class="floor">
                <div class="top">
                    <span>检查类型：</span>
                </div>
                <div class="project_list">
                    {foreach $case_type_list as $type}

                    {if condition="$type['type'] eq '1'"}
                    <span>
                        <em>{$type['name']}</em><i></i>
                        <input type="hidden" name="cid" value="{$type['id']}">
                    </span>

                    {/if}
                    {/foreach}
                    <form action="{:url('index/add_type')}" class="horizontal" method="post" role="form">
                        <div class="add_list">
                            <input type="hidden" name="type" value="1">
                            <input type="text" name="name">
                            <em class="ajax-post">确认</em>
                        </div>
                    </form>
                        <i class="add_leixing"></i>

                </div>
            </div>
            <div class="floor">
                <div class="top">
                    <span>检查部位：</span>
                </div>
                <div class="project_list">
                    {foreach $case_type_list as $type}
                    {if condition="$type['type'] eq '2'"}
                    <span>
                        <em>{$type['name']}</em><i></i>
                        <input type="hidden" name="cid" value="{$type['id']}">
                    </span>
                    {/if}
                    {/foreach}
                    <form action="{:url('index/add_type')}" class="horizontal" method="post" role="form">
                        <div class="add_list">
                            <input type="hidden" name="type" value="2">
                            <input type="text" name="name">
                            <em class="ajax-post">确认</em>
                        </div>
                    </form>

                        <i class="add_leixing"></i>

                </div>
            </div>
            <div class="floor">
                <div class="top">
                    <span>检查维度：</span>
                </div>
                <div class="project_list">
                    {foreach $case_type_list as $type}
                    {if condition="$type['type'] eq '3'"}
                    <span>
                        <em>{$type['name']}</em><i></i>
                        <input type="hidden" name="cid" value="{$type['id']}">
                    </span>

                    {/if}

                    {/foreach}
                    <form action="{:url('index/add_type')}" class="horizontal" method="post" role="form">
                        <div class="add_list">
                            <input type="hidden" name="type" value="3">
                            <input type="text" name="name">
                            <em class="ajax-post">确认</em>
                        </div>
                    </form>
                        <i class="add_leixing"></i>

                </div>
            </div>
        </div>
        <!-- 确认的  按钮 -->
        <!--<div class="save_or_no">-->
        <!--<a class="cirtain">-->
        <!--<input type="button" value="确定">-->
        <!--</a>-->
        <!--</div>-->
    </div>

</div>
{include file="public/footer"}
<script src="__STATIC__/common/webuploader/webuploader.min.js"></script>
<script type="text/javascript">


    var uploader = WebUploader.create({
        auto: true,
        swf: '__ASSETS__/lib/webuploader/Uploader.swf',
        server:'{:url("common/upload/uploadFile")}',
        pick: '#avatar',
        fileVal: 'pic'
    })

    uploader.on('uploadSuccess', function (file, response) {

        if (response.error == 0) {
            var html = '<img src="' + response.url + '"/>';
            html += '<input type="hidden" name="avatar" value="' + response.url + '"/>';
            $('#avatar-container').html(html);
        }
    });


</script>
<script>
    $(function () {
        // $(document).on("click",".set .liebiao .list_cont  i.add_leixing"),function(){
        // 	$(".set .liebiao .list_cont .add_list").css({"display":"inline-block"});
        // );
        $(document).on("click", ".set .liebiao .list_cont  i.add_leixing", function () {
            $(this).parent().find("input[name='name']").val("");

            $(this).parent().find(".add_list").css({"display": "inline-block"});
        });
        $(document).on("click", ".set .liebiao .list_cont .add_list em", function () {
            var leixing = $(this).parent().find("input[name='name']").val();
            if (leixing == "") {
                layer.msg("检查项必填", {icon: 6})

            } else {
                console.log(leixing);
                var html = "";
                html += "<span><em>" + leixing;
                ;
                html += "</em><i></i></span>";
                console.log(this);
                $(this).parent().parent().find(".add_list").before(html);
                $(this).parent().hide();
            }
        });
    })
</script>
<script>
    $(".set .liebiao .list_cont .floor .project_list span").mouseenter(function(){
       $(this).find("i").show();
    });
    $(".set .liebiao .list_cont .floor .project_list span").mouseleave(function(){
       $(this).find("i").hide();
    });
</script>
<script>
    $(function(){

        $(document).on("click",".liebiao .list_cont .floor .project_list span i",function(){

            $(this).parent().remove();
            var cid = $(this).parent().find("input[name='cid']").val();
            var name = $(this).parent().find("em").text();

            $.ajax({
                type: "post",
                url: "{:url('index/del')}",
                data: {
                    id: cid,name:name
                },
                dataType: "json",
                success:function (res) {
                    console.log(res);
                }, error: function (e) {

                }
            });
        })
    })
</script>

